<?php
namespace app\company\controller;

use app\BaseController;
use Tinywan\Jwt\JwtToken;

class Base extends BaseController
{
    /**
     * 从jwt中获取cid
     * @param ?string $key
     * @param $default
     * @return mixed
     */
    protected function getPayload(string $key = null, $default = null): mixed
    {
        if($key === null){
            return JwtToken::getExtend();
        }
        $value = JwtToken::getExtendVal($key);
        if($value){
            return $value;
        }else{
            return $default;
        }
    }

}
